﻿using System.Windows;
using System.Windows.Controls;

namespace WPFTestSolution.Pages.Controls.ContentControls.ButtonBases.ToggleButtons {
    
    /**
     * https://www.bilibili.com/video/BV1bV411A7Eq?p=32
     * 032-CheckBox复选框
     * https://www.wpfsoft.com/2023/08/23/1241.html
     *
     * CheckBox继承于ToggleButton，而ToggleButton才继承于ButtonBase基类。
     */
    public partial class _32_CheckBox_Page : Page {
        public _32_CheckBox_Page() {
            InitializeComponent();
            this.Title = "032-CheckBox复选框";
        }

        private void ButtonBase_OnClick(object sender, RoutedEventArgs e) {
            string order = string.Empty;
            if (this.CheckBox0.IsChecked == true) {
                order += this.CheckBox0.Content + ", ";
            }
            if (this.CheckBox1.IsChecked == true) {
                order += this.CheckBox1.Content + ", ";
            }
            if (this.CheckBox2.IsChecked == true) {
                order += this.CheckBox2.Content;
            }
            // if(!string.IsNullOrEmpty(order))
                MessageBox.Show($"你选择了: {order}");
        }
    }
}